#!/bin/bash

case $1 in
	start)
	java -jar /data/swarm/swarm-client.jar -master http://<%= @jenkins_server %>/jenkins/ >> /data/swarm/swarm.log 2>&1 & echo $! > /var/run/swarm.pid & echo "Started swarm OK"
	;;
	stop)
	kill `cat /var/run/swarm.pid` ;;
	*)
	echo "usage: swarm {start|stop}" ;;
esac
exit 0